package org.finesys.system.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.finesys.common.core.module.R;
import org.finesys.common.security.core.annotation.Inner;
import org.finesys.common.sms.Service.SmsService;
import org.finesys.system.constants.ControllerRestApiConfig;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequiredArgsConstructor
@RequestMapping(ControllerRestApiConfig.SMS)
@Tag(name = "短信管理模块")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class SysSmsController {

    private final SmsService smsService;

    /**
     * 发送短信
     *
     * @return 用户信息
     */
    @Inner(value = false)
    @Operation(summary = "发送短信验证码")
    @GetMapping("/sendSms/{mobile}")
    public R<Boolean> sendSms(@PathVariable String mobile) {
        return R.success(smsService.sendSmsCode(mobile));
    }
}
